package com.lm.iotdb.component;

import org.osgi.service.component.annotations.Component;

import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;

@Component
public class UploadProgressCache {
    private final Map<String, Long> progressMap = new ConcurrentHashMap<>();

    public Long getLastTimestamp(String deviceId) {
        return progressMap.getOrDefault(deviceId, 0L);
    }

    public void updateTimestamp(String deviceId, long timestamp) {
        progressMap.put(deviceId, timestamp);
    }
}